home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-12 | 2.4 KB | 86 lines | [TEXT/MMCC] |
- // ===========================================================================
- // LHierarchicalListBox.h ©1994 Jan Bruyndonckx All rights reserved.
- // v1.0 18/6/94
- //
- // A hierarchical listbox subclass. The listbox contains only string data.
- // ===========================================================================
-
- #pragma once
-
- #include "CCustomListBox.h"
-
- //----------------------------------------------------------------------------
-
- typedef enum {
- kHasSubList = 0x01, // item contains sub-items (eg. folder)
- kIsOpened = 0x02, // the item is opened
- kDrawFilled = 0x04, // draw the triangle filled
- kDrawIntermediate = 0x08 // draw intermediate state
- } TwistFlags ;
-
- #if defined(powerc)
- #pragma options align=mac68k
- #endif
-
- #define TWIST_DOWN_HEAD \
- Byte indent ; /* indentation level */ \
- Byte flags ; /* display flags */
-
- typedef struct {
- TWIST_DOWN_HEAD
- } TwistDownHeader ;
-
- typedef struct {
- TWIST_DOWN_HEAD
- Byte data[2] ; // variable length of data (default=P-String)
- } TwistDownRec, *TwistDownRecPtr ;
-
- #if defined(powerc)
- #pragma options align=reset
- #endif
-
- #define TwistDownRecSize (sizeof(TwistDownHeader)) // don't count the variable 'data' field
-
- //----------------------------------------------------------------------------
-
- class CTwistDownListBox : public CCustomListBox {
-
- public:
- enum {
- classID = 'hlst'
- } ;
-
- static CTwistDownListBox* CreateFromStream(LStream *inStream);
-
- CTwistDownListBox() ;
- CTwistDownListBox(const SPaneInfo &inPaneInfo,
- Boolean inHasHorizScroll, Boolean inHasVertScroll,
- Boolean inHasGrow, Boolean inHasFocusBox,
- MessageT inDoubleClickMessage, Int16 inTextTraitsID,
- LCommander *inSuper);
- CTwistDownListBox(LStream *inStream);
-
- virtual StringPtr GetDescriptor(Str255 outDescriptor) const;
- virtual void SetDescriptor(ConstStr255Param inDescriptor);
-
- protected:
- short triangleWidth ; // width of the triangle area
-
- virtual void ClickSelf(const SMouseDownEvent &inMouseDown);
- virtual void DrawElementSelf (const Rect *lRect,
- const void *lElement,
- const short lDataLen) ;
- virtual void DrawTwistedElement (const Rect *lRect,
- const TwistDownRecPtr twistElement,
- const short lDataLen) ;
-
- virtual void CollapseElement (const Cell theCell) ;
- virtual void ExpandElement (const Cell theCell) ;
-
- private:
- void init (void) ;
-
- static PolyHandle sClosedPoly,
- sOpenedPoly,
- sIntermediatePoly ;
- } ;